-
Notifications
You must be signed in to change notification settings - Fork 108
feat: add funnelIds to remoteConfig and handle development defaults #2899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Development Mode Funnel ID Retrieval Bug
In development mode (!isProd && !isTest
), the resolveDynamicFunnelId
function's logic for returning static funnel IDs is flawed. If GROWTHBOOK_API_CONFIG_CLIENT_KEY
is set, remoteConfig.vars
attempts to fetch from GrowthBook instead of providing the intended hardcoded development defaults. This leads to two issues:
- If GrowthBook doesn't return
funnelIds
, the function falls back to 'off' instead of the expected static values, contradicting the code comment. - Accessing
remoteConfig.vars
beforeremoteConfig.init()
completes can throw a "remote config not initialized" error, creating a race condition during application startup whenGROWTHBOOK_API_CONFIG_CLIENT_KEY
is present.
src/routes/boot.ts#L789-L794
Lines 789 to 794 in c684915
}); | |
if (!isProd && !isTest) { | |
// In development, we use a static value for the feature key | |
return remoteConfig?.vars?.funnelIds?.[featureKey] || 'off'; | |
} | |
return gbClient.getFeatureValue(featureKey, 'off'); |
Comment bugbot run
to trigger another review on this PR
Was this report helpful? Give feedback by reacting with 👍 or 👎
@@ -28,6 +28,7 @@ type RemoteConfigValue = { | |||
paddleIps: string[]; | |||
paddleTestDiscountIds: string[]; | |||
paddleProductIds: Partial<Record<PurchaseType, string>>; | |||
funnelIds: Record<string, string>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this typed web_funnel_id
, onboarding_funnel_id
, I don't think we will introduce many different funnel types as much + also they need other changes so better to have it typed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
funnelIds: Record<string, string>; | |
funnelIds: Partial<{ | |
web_funnel_id: string, | |
onboarding_funnel_id: string | |
}>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just the type change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing besides Ante's feedback
No description provided.